import request from '@/utils/request'

/**
 * 获取全部Cpu数据
 * @returns
 */
export function getCup() {
  return request({
    url: '/monitor/cpu',
    method: 'get'
  })
}

/**
 * 根据主机ip获取Cpu数据
 * @param ip
 */
export function getCupByIp(ip) {
  return request({
    url: `/monitor/cpu/${ip}`,
    method: 'get'
  })
}

export function getCupByIpAndTime(ip, time) {
  return request({
    url: `/monitor/cpuusage`,
    method: 'get',
    params: {
      hostname: ip,
      periodType: time
    }
  })
}

export function getMemByIpAndTime(ip, time) {
  return request({
    url: `/monitor/memusage`,
    method: 'get',
    params: {
      hostname: ip,
      periodType: time
    }
  })
}

/**
 * 获取储存空间数据
 * @returns
 */
export function getDesk() {
  return request({
    url: '/monitor/desk',
    method: 'get'
  })
}

/**
 * 获取内存数据
 * @returns
 */
export function getMem() {
  return request({
    url: '/monitor/mem',
    method: 'get'
  })
}

/**
 * 根据主机ip获取内存数据
 * @param ip
 */
export function getMemByIp(ip) {
  return request({
    url: `/monitor/mem/${ip}`,
    method: 'get'
  })
}
/**
 * 获取网络数据
 * @returns
 */
export function getNetio() {
  return request({
    url: '/monitor/netio',
    method: 'get'
  })
}

